package com.wuseguang.springcloud.service.impl;

import com.wuseguang.springcloud.dao.jdbc.OiCountdownJdbc;
import com.wuseguang.springcloud.dao.repository.OiCountdownRepository;
import com.wuseguang.springcloud.entity.OiCountdown;
import com.wuseguang.springcloud.service.OiCountdownService;
import com.wuseguang.springcloud.util.DateUtil;
import com.wuseguang.springcloud.util.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 事件倒计时 服务实现类
 * </p>
 *
 * @author 
 * @since 2020-06-30
 */
@Service
public class OiCountdownServiceImpl implements OiCountdownService {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private OiCountdownJdbc oiCountdownJdbc;
    @Autowired
    private OiCountdownRepository oiCountdownRepository;


    @Override
    public Result findOiCountdownTo(String deviceid) {

        Map<String, Object> stringObjectMap4 = oiCountdownJdbc.queryDevice(deviceid);
        OiCountdown oiCountdownOne = oiCountdownRepository.findByClassIdAndTopping(Integer.valueOf(stringObjectMap4.get("classid").toString()),1);
        return new Result(oiCountdownOne);
    }
}
